using System.Collections.Generic;
using System.Linq;
using Tools.Domain.Specifications;
using Webshop20.Domain.Shared.Products.Core;

namespace Webshop20.Domain.Shared.Products.Specifications
{
    public class ProductsAreInArraySpecification : Specification<Product>
    {
        private readonly IEnumerable<int> productIds;

        public ProductsAreInArraySpecification(IEnumerable<int> productIds) 
            : base(product => productIds.Contains(product.Id), "NO_PRODUCTS_FOUND")
        {
            this.productIds = productIds;
        }

        public IEnumerable<int> ProductIds
        {
            get { return productIds; }
        }
    }
}